<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:h="http://java.sun.com/jsf/html" 
     xmlns:p="http://primefaces.prime.com.tr/ui"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:f="http://java.sun.com/jsf/core">  
   
    <h:head>
        <title>:.Medral Tecnologia Penha.:</title>
    </h:head>
    
     <h:body style="background-color: paleturquoise">
         <ui:include src="/paginas/menu.xhtml"/>
        
    <p:growl id="avisos" showDetail="true" life="3000" />  

    <p:fieldset legend="ESTOQUE DE PRODUTOS CADASTRADOS:" toggleable="true">  
    <h:form> 
       <h:panelGrid columns="8">
            <h:outputText value="Data do Cadastro:" />  
            <p:calendar value="#{testeBean.dataCadastro}" maxlength="8" size="10"/>
            
            <h:outputText value="Descrição:"/>
            <p:inputText id="descricao" value="#{testeBean.descricao}" maxlength="35" size="40"/>
            <p:commandButton value="PROCURAR" actionListener="#{testeBean.procurar}" type="submit" />
            
            <h:outputText value="Código:"/>
            <p:inputMask mask="99.999" value="#{testeBean.codigo}" maxlength="6" size="7" />
            <p:commandButton value="PROCURAR" actionListener="#{testeBean.procurar2}" type="submit" />
        </h:panelGrid>
    </h:form>  
  </p:fieldset> 
    
        <p:fieldset legend="LISTA GERAL:" toggleable="true">  
        <h:form id="form">
           <p:growl id="msgs" />

                 <p:outputPanel id="books">
                    <p:dataTable id="booksTable" value="#{bookBean.books}" var="book">

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Data do Cadastro" />
                            </f:facet>
                            <h:outputText value="#{book.data}" />
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="idProduto" />
                            </f:facet>
                            <h:outputText value="#{book.idproduto}" />
                        </p:column>
                        
                        <p:column>
                            <f:facet name="header">
                             <h:outputText value="Produto" />
                            </f:facet>
                            <h:outputText value="#{book.produto}"/>
                        </p:column>
                        
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Quantidade" />
                            </f:facet>
                            <h:outputText value="#{book.quantidade}" />
                        </p:column>
                        
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Alterar Quantidade" />
                            </f:facet>
                            <h:outputText value="#{book.alterarquantidade}" />
                        </p:column>
                        
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Condição" />
                            </f:facet>
                            <h:outputText value="#{book.condicao}" />
                        </p:column>
                        
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Operação" />
                            </f:facet>
                                               
                            <p:commandLink value="ATUALIZAR" update=":form:books" process=":form:books">
                                <p:collector value="#{book}" removeFrom="#{bookBean.books2}" />
                            </p:commandLink>
                        </p:column>
                    </p:dataTable>
                </p:outputPanel>
            </h:form>  
        </p:fieldset>    
    </h:body>  
 </html> 

